local skynet = require "skynet"
local sprotoloader = require "sprotoloader"

local max_client = 64

skynet.start(function()
    skynet.error("Server start")
    skynet.uniqueservice("protoloader")
    if not skynet.getenv "daemon" then
        local console = skynet.newservice("console")
    end
    skynet.newservice("debug_console", 8000)
    skynet.newservice("simpledb")
    -- 1.创建一个watchdog的服务，见watchdog.lua
    local watchdog = skynet.newservice("watchdog")

	--watchdog和gate初始化完毕，执行mian的监听请求
    skynet.call(watchdog, "lua", "start", --调用watchdog的start函数
                {port = 8888, maxclient = max_client, nodelay = true})
    skynet.error("Watchdog listen on", 8888)
    skynet.exit()
end)
